<?php
  //Buffer larger content areas like the main page content
  ob_start();
?>
<?php  		include("config.php");

require_once("auth.php"); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Category Details</title>
<script>
function funadd()
{
window.location	="category.php";
}
function fundel(t)
{

var r=confirm("Do you want to delete the category?");
if (r==true)
  {
  window.location="delete.php?categoryid=" +t;
  }
else
  {
return false;  }
}

function funedit(t)
{
  window.location="category.php?id=" +t;

}

function fundetails(t)
{
  window.location="categorydisplay.php?id=" +t;

}


</script>
</head>

<body>
<table  width="100%" align="center" cellpadding="5">
<tr bgcolor="#ADADAD">
  <td style="color:#363636; font-size:18px; font-weight:bold" colspan="2">Category Information</td>
</tr>
<tr>
  <td width="53%"><input name="button" type="button" style="width:;  line-height:15px; font-weight:bold" onclick="funadd();" value="Add Category" /> </td></tr>
<tr><td colspan="2">
<table width="100%">
<tr bgcolor="#5D5D5D">
<th ><table>
    <thead>
      <tr>
        <th rowspan="1"><a href="#"  style="color:#fff; font-weight:normal; text-decoration:none">Category ID</a></th>
      </tr>
    </thead>
  </table></th>
  <th ><table>
    <thead>
      <tr>
        <th rowspan="1"><a href="#"  style="color:#fff; font-weight:normal; text-decoration:none">Category Name</a></th>
      </tr>
    </thead>
  </table></th>
  <th width="28%" ><table>
    <thead>
      <tr>
        <th rowspan="1"><a href="#"  style="color:#fff; font-weight:normal; text-decoration:none">Description</a></th>
      </tr>
    </thead>
  </table></th>
     <th width="10%"><table>
    <thead>
      <tr>
        <th rowspan="1"><!--<input type="checkbox" name="chkall">-->
		<a href="#"  style="color:#fff; font-weight:normal; text-decoration:none">Details</a>		</th>
      </tr>
    </thead>
  </table></th>
 


   <th width="10%"><table>
    <thead>
      <tr>
        <th rowspan="1"><!--<input type="checkbox" name="chkall">-->
		<a href="#"  style="color:#fff; font-weight:normal; text-decoration:none">Edit</a>		</th>
      </tr>
    </thead>
  </table></th>

   <th width="12%"><table>
    <thead>
      <tr>
        <th rowspan="1" style="color:#fff; font-weight:normal; text-decoration:none" >Delete		</th>
      </tr>
    </thead>
  </table></th>
  
  </tr>
  
<?php


$data=mysql_query("select * from maincategories ");
$no=mysql_num_rows($data);
$i=0;
if($no!=0)
{
	while($rec=mysql_fetch_assoc($data))
	{
		if($i%2==0)
	$color="#DFF0D8";
	else
	$color="#ddd";
	$i++;

?>

<tr id="row1" style="text-align:left; color:#000000; background-color:<?php echo $color; ?>" onmouseover="this.style.background='#667987'; this.style.color='#fff'" onmouseout="this.style.background='<?php echo $color; ?>';this.style.color='#000000'">
	<td ><?php echo "CATE".$rec['maincatid']; ?></td>

<td> <?php echo $rec['maincatname']; ?></td>
	<td ><?php echo $rec['desc']; ?></td>
	
      <td><a href="javascript:"  onClick="fundetails('<?php echo $rec['maincatid']; ?>')">Details</a></td>

   <td><a href="javascript:"  onClick="funedit('<?php echo $rec['maincatid']; ?>')">Edit</a></td>
   <td><a href="javascript:" onClick="fundel('<?php echo $rec['maincatid']; ?>')">Delete</a></td>
 
</tr>    
    
<?php
	}
}
?>
</table>
</td></tr></table>


</body>
</html>
 <?php
  //Assign all Page Specific variables
  $pagemaincontent = ob_get_contents();
  ob_end_clean();
  $pagetitle = "Categorys";
  //Apply the template
  include("master.php");
?>    